// 导入Vue
import Vue from 'vue'
// 导入 i18n
import VueI18n from 'vue-i18n'
// 实例化
Vue.use(VueI18n)

// 导入语言包
import en from './en'
import zh from './zh'

// 导入element UI 的语言包
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

// 导入cookies
import Cookies from 'js-cookie'
let messages = {
    en: {
        'test': 'test',
        home: {
            calendar: 'calendar',
            morning: 'Good Morning',
            user:'The administrator',
            happy:'Happy To You Everyday!'
        },
        ...en,
        ...enLocale
    },
    zh: {
        'test': '测试',
        home: {
            calendar: '工作日历',
            morning: '早上好',
            user:'管理员',
            happy:'祝你开心每一天！'
        },
        ...zh,
        ...zhLocale
    }
}

let i18n = new VueI18n({
    locale: Cookies.get('lang') || 'zh',
    messages
})

export default i18n